<?php include "top.php"; ?>
<script src="uploadify/swfobject.js"  language="javascript" ></script>
<script src="uploadify/jquery.uploadify.v2.1.4.min.js"  language="javascript" ></script>
<link href="uploadify/uploadify.css" rel="stylesheet" type="text/css" />
 <?php
		 $nid=make_safe($_GET["nid"]); 
		 $BigClassName=make_safe($_GET["BigClassName"]); 
		 if($nid==""){$nid=1;}
		 
		if($nid==1){$nidname="公司樣本";}
		 if($nid==2){$nidname="禮服";}
		 if($nid==3){$nidname="客戶";}
		 
		 
		?>
      <div id="top-3">
        <div id="m-text-1">
        <table border="0" cellpadding="0" cellspacing="0" class="tab-5">
   <tr>
     <td valign="top"><div class="tab-5-tit">主功能列表</div>
     
	 
	 
	 
	  <div class="m-text-2_btn"><a href="category.php?nid=<?php echo $nid;?>">作品分類管理</a></div>
     
        <div class="tab-5-tit">相簿管理</div>
      
	 
	 <?php
  $n=1;

  $sql="select * from product_type_big where nid='$nid' order by orderid  ";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
     <div class="m-text-2_btn"><a href="working.php?nid=<?php echo $nid;?>&BigClassName=<?php echo urlencode($row->BigClassName);?>"><?php echo $row->BigClassName;?></a></div>
     <?php }?>
	 
	 
	 
	 
	 
	 
	 
	 
       </td>
   </tr>
   </table>
        </div>
        <div id="m-text-2_banner">
          <ul>
        
            <li>/ </li>
            
            <li>培豪作品管理->增加</li>
          </ul>
        </div><div id="m-text-2"></td>
   </tr>
   </table>
   
   
   
   
      <?php 
   $nid=make_safe($_GET["nid"]); 
   $action=make_safe($_GET["action"]);
    
   $title=make_safe($_GET["title"]); 
   if($title==""){$title=make_safe($_POST["title"]);}
   
   
   $BigClassName=make_safe($_GET["BigClassName"]);
   if($BigClassName==""){$BigClassName=make_safe($_POST["BigClassName"]);} 
   $addtime=$data3;
   
   if($action=="add"){
   $totalimage = 10;
   for($i=0;$i<$totalimage;$i++)
   {
    
   		if($i == 0)
   			$image_index_number = '';
   		else
   			$image_index_number = $i+1;
   		 $upload_image_name = $_POST['ajaxf_images'.$image_index_number];
   		 if(strlen($upload_image_name) > 0)
   		 {
   		 	$path =  "upfiles/tmp/".$upload_image_name;
  		 	$type=strstr($path,'.');
  			 $path2 = "upfiles/".$data.$image_index_number.$type;
   			$type=strtolower($type);
   			
   			copy("../".$path,"../".$path2);
			unlink("../".$path);
			
			$srcImage = "../".$path2;
			 $desc = $srcImage.'-68x68.jpg';
			 make_thumnail($srcImage,$desc ,68,68,'4');
			 
			$sql="Insert Into product2 (title,entitle,nid,BigClassName,enBigClassName,addtime,images) Values('$title','$entitle','$nid','$BigClassName','$enBigClassName','$addtime','$path2')";
			$result=mysql_query($sql);
			
   		}
   }
echo "<script> alert('增加成功！');window.location.href='product2.php?nid=$nid&BigClassName=$BigClassName&title=$title';</script>";
   
    }
   
   
   ?>
   
   

   
   				<script language="javascript">
			$(function(){
				$(".uploadifyupload").each(function(){
					var current_id = $(this).attr('id');
					var previous_img_id = current_id + '_img';
					$(this).uploadify({
						'uploader': 'uploadify/uploadify.swf',
						'cancelImg': 'uploadify/cancel.png',
						'script': 'upload.php',
						'folder': 'files',
						'buttonText':'Choose',
						'multi': false,
						'fileExt':'*.jpg;*.jpeg;*.gif;*.png',
  						'fileDesc':'Image Files',
						'auto': true,
						'queueSizeLimit':1,
						'scriptData':{'<?php echo session_name();?>':'<?php echo session_id();?>','name':$(this).attr('name'),'responsetype':'sizeinfo'},
						'displayData': 'speed',
						'onComplete':function(event,queueID,fileObj,response,data){
							var responseObj = eval("("+response+")");
							var fileName = responseObj.name;
							$('#'+previous_img_id).attr('src','../upfiles/tmp/' + fileName);
							$('input[name=ajaxf_'+current_id+']').val(fileName);
							
						},
						'onError':function(event,queueId,fileObj,errorObj){
							alert(errorObj);
						}
					});
				});
			});
		</script>
   
   
        <form name="form1" action="?action=add&nid=<?php echo $nid;?>&title=<?php echo urlencode($row->title);?>" method="post" enctype="multipart/form-data" target="_self">
        
        <table border="0" cellpadding="0" cellspacing="0" class="m-text-2-imp">
		
		
		<tr>
            <td class="m-text-2-con2">類別：
             
              <select name="BigClassName" >
			  
			  <?php
  $n=1;

  $sql2="select * from product_type_big where nid='$nid' order by orderid  ";			
	$result2=mysql_query($sql2);
	while ($row2=mysql_fetch_object($result2)){
	?>
    
	 <option  value="<?php echo $row2->BigClassName;?>"   <?php if($BigClassName==$row2->BigClassName){echo "selected";}?>><?php echo $row2->BigClassName;?></option>
	
     <?php }?>
			  
                
              </select></td>
            </td>
          </tr>
          <tr>
            <td class="m-text-2-con2">相簿名稱：
             
              <select name="title" >
			  
			  <?php
  $n=1;

  $sql2="select * from product where nid='$nid' order by id  ";			
	$result2=mysql_query($sql2);
	while ($row2=mysql_fetch_object($result2)){
	?>
    
	 <option  value="<?php echo $row2->title;?>"   <?php if($title==$row2->title){echo "selected";}?>><?php echo $row2->title;?></option>
	
     <?php }?>
			  
                
              </select>
              </td>
            
          </tr>
		  <tr>
		  <td class="m-text-2-con2">名稱：<input name="content" value=""></td>
		  </tr>
		  <tr>
            <td class="m-text-2-con2">上傳作品1：
            <img id="images_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images" value=""/>
              <input name="images" class="uploadifyupload" id="images" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品2：
            <img id="images2_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images2" value=""/>
              <input name="images2" class="uploadifyupload" id="images2" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品3：
            <img id="images3_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images3" value=""/>
              <input name="images3" class="uploadifyupload" id="images3" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品4：
            <img id="images4_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images4" value=""/>
              <input name="images4" class="uploadifyupload" id="images4" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品5：
            <img id="images5_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images5" value=""/>
              <input name="images5" class="uploadifyupload" id="images5" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品6：
            <img id="images6_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images6" value=""/>
              <input name="images6" class="uploadifyupload" id="images6" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品7：
            <img id="images7_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images7" value=""/>
              <input name="images7" class="uploadifyupload" id="images7" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品8：
            <img id="images8_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images8" value=""/>
              <input name="images8" class="uploadifyupload" id="images8" type="file"  size="60"></td>
        
          </tr>
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品9：
            <img id="images9_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images9" value=""/>
              <input name="images9" class="uploadifyupload" id="images9" type="file"  size="60"></td>
        
          </tr>
		  
		  
		   <tr>
            <td class="m-text-2-con2">上傳作品10：
            <img id="images10_img" src="../pic/blank.gif" width="50" height="50" border="0"  />
             <input type="hidden" name="ajaxf_images10" value=""/>
              <input name="images10" class="uploadifyupload" id="images10" type="file"  size="60"></td>
        
          </tr>
		  
		  
		  
		  <tr>
            <td class="m-text-2-con2"><div align="center">
              <input type="submit" name="Submit" value="提交保存">
            </div></td>
            
          </tr>
        </table>
        </form>
        </div>
      </div>
    </div>
  </div>
</div>
<div id="botton"><div id="copyright"><table border="0" cellpadding="0" cellspacing="0" class="copy">
  <tr>
    <td>© COPYRIGHTS 2010 INC. APARTMENT STUDIO All rights reserved.</td>
  </tr>
</table>
</div></div>
</body>
</html>